<?php if ( post_password_required() ) : ?>
	<p class="nopassword"><?php _e( 'This post is password protected. Enter the password to view any comments.' ); ?></p>
<!-- #comments -->
<?php
	return;
endif;
?>

<?php if ( have_comments() ) : ?>
	<div id="comments" class="cycle">
		<h3 id="comments-title"><span><?php comments_number('0', '1', '%' );?>条评论</span> <span class="add_comment">[<a href="#respond" rel="nofollow">发表评论</a>]</span></h3>
	
		<ol class="commentlist">
			<?php wp_list_comments('type=all&callback=txtjee_comment'); ?>
		</ol>

<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
		<div class="page-bar">
			<?php paginate_comments_links('prev_next=0');?>
		</div>
<?php endif; ?>
	</div>
<?php elseif ( ! comments_open() && ! is_page() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
	<p class="nocomments"><?php _e( 'Comments are closed.' ); ?></p>
<?php endif; ?>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/includes/smiley.js"></script>
<?php
$tpurl = get_template_directory_uri();
$smilies = '<div class="smiley cycle">
<a onclick="javascript:grin(\'/谄笑\');"><img src="'. $tpurl .'/smilies/icon_twisted.gif" title="谄笑" alt="谄笑" /></a>
<a onclick="javascript:grin(\'/调皮\');"><img src="'. $tpurl .'/smilies/icon_wink.gif" title="调皮" alt="调皮" /></a>
<a onclick="javascript:grin(\'/阴险\');"><img src="'. $tpurl .'/smilies/icon_evil.gif" title="阴险" alt="阴险" /></a>
<a onclick="javascript:grin(\'/舔\');"><img src="'. $tpurl .'/smilies/icon_eek.gif" title="舔" alt="舔" /></a>
<a onclick="javascript:grin(\'/大笑\');"><img src="'. $tpurl .'/smilies/icon_lol.gif" title="大笑" alt="大笑" /></a>
<a onclick="javascript:grin(\'/抠鼻\');"><img src="'. $tpurl .'/smilies/icon_kbz.gif" title="抠鼻" alt="抠鼻" /></a>
<a onclick="javascript:grin(\'/可爱\');"><img src="'. $tpurl .'/smilies/icon_redface.gif" title="可爱" alt="可爱" /></a>
<a onclick="javascript:grin(\'/流口水\');"><img src="'. $tpurl .'/smilies/icon_idea.gif" title="流口水" alt="流口水" /></a>
<a onclick="javascript:grin(\'/吃\');"><img src="'. $tpurl .'/smilies/icon_mrgreen.gif" title="吃" alt="吃" /></a>
<a onclick="javascript:grin(\'/色\');"><img src="'. $tpurl .'/smilies/icon_razz.gif" title="色" alt="色" /></a>
<a onclick="javascript:grin(\'/抛媚眼\');"><img src="'. $tpurl .'/smilies/icon_biggrin.gif" title="抛媚眼" alt="抛媚眼" /></a>
<a onclick="javascript:grin(\'/囧\');"><img src="'. $tpurl .'/smilies/icon_arrow.gif" title="囧" alt="囧" /></a>
<a onclick="javascript:grin(\'/尴尬\');"><img src="'. $tpurl .'/smilies/icon_gg.gif" title="尴尬" alt="尴尬" /></a>
<a onclick="javascript:grin(\'/惊恐\');"><img src="'. $tpurl .'/smilies/icon_shock.gif" title="惊恐" alt="惊恐" /></a>
<a onclick="javascript:grin(\'/惊讶\');"><img src="'. $tpurl .'/smilies/icon_surprised.gif" title="惊讶" alt="惊讶" /></a>
<a onclick="javascript:grin(\'/晕\');"><img src="'. $tpurl .'/smilies/icon_confused.gif" title="晕" alt="晕" /></a>
<a onclick="javascript:grin(\'/汗\');"><img src="'. $tpurl .'/smilies/icon_question.gif" title="汗" alt="汗" /></a>
<a onclick="javascript:grin(\'/闭嘴\');"><img src="'. $tpurl .'/smilies/icon_exclaim.gif" title="闭嘴" alt="闭嘴" /></a>
<a onclick="javascript:grin(\'/悲伤\');"><img src="'. $tpurl .'/smilies/icon_sad.gif" title="悲伤" alt="悲伤" /></a>
<a onclick="javascript:grin(\'/哭\');"><img src="'. $tpurl .'/smilies/icon_cry.gif" title="哭" alt="哭" /></a>
<a onclick="javascript:grin(\'/萌\');"><img src="'. $tpurl .'/smilies/icon_rolleyes.gif" title="萌" alt="萌" /></a>
<a onclick="javascript:grin(\'/愤怒\');"><img src="'. $tpurl .'/smilies/icon_mad.gif" title="愤怒" alt="愤怒" /></a>
<a onclick="javascript:grin(\'/酷\');"><img src="'. $tpurl .'/smilies/icon_cool.gif" title="酷" alt="酷" /></a>
<a onclick="javascript:grin(\'/烧香\');"><img src="'. $tpurl .'/smilies/icon_shaoxiang.gif" title="烧香" alt="烧香" /></a>
<a onclick="javascript:grin(\'/书呆子\');"><img src="'. $tpurl .'/smilies/icon_see.gif" title="书呆子" alt="书呆子" /></a>
<a onclick="javascript:grin(\'/困\');"><img src="'. $tpurl .'/smilies/icon_sleepy.gif" title="困" alt="困" /></a>
<a onclick="javascript:grin(\'/不要\');"><img src="'. $tpurl .'/smilies/icon_nonono.gif" title="不要" alt="不要" /></a>
<a onclick="javascript:grin(\'/笑\');"><img src="'. $tpurl .'/smilies/icon_smile.gif" title="笑" alt="笑" /></a>
<a onclick="javascript:grin(\'/害羞\');"><img src="'. $tpurl .'/smilies/icon_neutral.gif" title="害羞" alt="害羞" /></a>
<a onclick="javascript:grin(\'/防流感\');"><img src="'. $tpurl .'/smilies/icon_av.gif" title="防流感" alt="防流感" /></a>
<a onclick="javascript:grin(\'/生病\');"><img src="'. $tpurl .'/smilies/icon_sick.gif" title="生病" alt="生病" /></a>
<a onclick="javascript:grin(\'/呕吐\');"><img src="'. $tpurl .'/smilies/icon_vomit.gif" title="呕吐" alt="呕吐" /></a>
<a onclick="javascript:grin(\'/惊叹号\');"><img src="'. $tpurl .'/smilies/icon_exclamation.gif" title="惊叹号" alt="惊叹号" /></a>
<a onclick="javascript:grin(\'/有木有\');"><img src="'. $tpurl .'/smilies/icon_youmuyou.gif" title="有木有" alt="有木有" /></a>
<a onclick="javascript:grin(\'/给力\');"><img src="'. $tpurl .'/smilies/icon_gl.gif" title="给力" alt="给力" /></a>
<a onclick="javascript:grin(\'/不给力\');"><img src="'. $tpurl .'/smilies/icon_bgl.gif" title="不给力" alt="不给力" /></a>
<a onclick="javascript:grin(\'/伤不起\');"><img src="'. $tpurl .'/smilies/icon_sbq.gif" title="伤不起" alt="伤不起" /></a>
</div>';

function txtjee_fields($fields) {
	$commenter = wp_get_current_commenter();
	$req = get_option( 'require_name_email' );
	$aria_req = ( $req ? " aria-required='true'" : '' );
    $fields =  array(
		'author'=> '<p class="comment-form-field comment-form-author">' .
					'<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /><label for="author">昵称</label> <span class="required">必填</span></p>',
		'email'	=> '<p class="comment-form-field comment-form-email">' .
					'<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /><label for="email">邮箱</label> <span class="required">必填，不会公开</span></p>',
		//'url'	=> '<p class="comment-form-field comment-form-url">' .
		//			'<input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /><label for="url">网站</label> <span class="tip">可以是微博、博客、空间等</span></p>',
    );
	return $fields;
}
add_filter('comment_form_default_fields','txtjee_fields');
$args = array(
	'comment_field'			=> $smilies . '<p class="comment-form-comment"><textarea aria-required="true" rows="8" cols="45" name="comment" id="comment" onkeydown="if((event.ctrlKey||event.metaKey)&&event.keyCode==13){document.getElementById(\'submit\').click();return false};"></textarea></p>',
	'label_submit'			=> '发表评论 / Ctrl+Enter',
	'form-allowed-tags'		=> '',
	'comment_notes_before'	=>  '',
	'comment_notes_after'	=>  '',
);
comment_form($args); 
?>
